package com.opennetexam.manager.service;

import com.opennetexam.manager.databasemodel.PackageExamReportResult;
import com.opennetexam.manager.mapper.FreeExamReportMapper;
import com.opennetexam.manager.mapper.PackageExamReportResultMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Description TODO
 * @Author 奶茶
 * Created by on 2019/2/19 18:46.
 */
@Service
@Transactional
public class ExamReportService {

    @Autowired
    private FreeExamReportMapper freeExamReportMapper;
    @Autowired
    private PackageExamReportResultMapper packageExamReportResultMapper;

    /**
     * 查询当前计划下的当前科目是否生成过结果包
     * @param examPlanID
     * @param examSubjectID
     * @return
     */
    public Boolean getExamReportCountBYExamPlanIDANDExamSubjectID(String examPlanID,String examSubjectID){
        return freeExamReportMapper.getExamReportCountBYExamPlanIDANDExamSubjectID(examPlanID, examSubjectID) == 0;
    }

    /**
     * 插入考试结果打包结果
     * @param packageExamReportResult
     */
    public void insertPackageExamReportResult(PackageExamReportResult packageExamReportResult){
        packageExamReportResultMapper.insert(packageExamReportResult);
    }

}
